package com.niit.service.Impl;

import com.niit.dao.ClassDao;
import com.niit.model.Classes;
import com.niit.service.ClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class ClassServiceImpl  implements ClassService {
    @Autowired
    private ClassDao classDao;


    @Override
    public List<Classes> selectClassId(Long id) {
        return classDao.selectClassById(id);
    }
    @Override
    public int deleteClassById(Long id1,Long id2){
        return classDao.deleteClassById(id1, id2); }

    @Override
    public int addStudentClassById(Long id1, Long id2, Date date){
        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        return classDao.addStudentClassById(id1, id2,dateFormat.format(date)); }}
